package com.lhb.beanLifecycle;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;

/**
 * @Program: spring
 * @Description:
 * @Author: LHB
 * @Version: v0.0.1
 * @Time: 2021-08-12 18:05
 **/
@Component
public class MyBeanPostProcessor implements BeanPostProcessor {
	@Override
	public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
		if (beanName.equals("beanLifecycle")) {
			System.out.println("==> postProcessBeforeInitialization");
		}
		return bean;
	}

	@Override
	public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
		if (beanName.equals("beanLifecycle")) {
			System.out.println("==> postProcessAfterInitialization");
		}
		return bean;
	}
}
